<?php

include '../operations/connection.php';
$query_testproject = mysql_query("select IDTest,IDProject,Title,TextTest from pr_testproject WHERE IDTest='".$_REQUEST['id']."'");
$listattach = mysql_query('select id, testprojectid, filepath, filereal, filename, filetype, filesize, createdate from pre_attach where testprojectid='.$_REQUEST['id']);
if(count($query_testproject)>0){
	$row=mysql_fetch_array($query_testproject);
	$stringtitle = substr($row[Title],0,-14);
	$titlecolor = substr($row[Title],-6);

	?>
<div>
	<textarea id="title"><?=$stringtitle?></textarea>
	<div id="titlecolor"><?=$titlecolor?></div>
	<div id="content"><?=$row[TextTest]?></div>
	<div id='listattach'>
		<?php 
		$temindex = 0;
		while ($rowattach = mysql_fetch_array($listattach)) {?>
			<div style="padding:1px">
				<input type="hidden" id="flagattach" name="flagattach[<?=$temindex?>]]" value="true"/>
				<input type="checkbox" onclick="checkAttach(this)" style="margin:1px" checked="checked" filepath="<?=$rowattach[filepath].$rowattach[filereal]?>" />
				<a
					href="admin/attach/downloadattach.php?filepath=<?=$rowattach[filepath].$rowattach[filereal]?>&filename=<?=$rowattach[filename]?>&filetype=<?=$rowattach[filetype]?>">
					<?=$rowattach[filename]."(".$rowattach[filetype].") ".$rowattach[filesize]?></a>
				<input type="hidden" name="attachpath[<?=$temindex?>]" value="<?=$rowattach[filepath]?>" />
				<input type="hidden" name="attachreal[<?=$temindex?>]" value="<?=$rowattach[filereal]?>" />
				<input type="hidden" name="attachfile[<?=$temindex?>]" value="<?=$rowattach[filename]?>" />
				<input type="hidden" name="attachtype[<?=$temindex?>]" value="<?=$rowattach[filetype]?>" />
				<input type="hidden" name="attachsize[<?=$temindex?>]" value="<?=$rowattach[filesize]?>" />
				<input type="hidden" name="attachid[<?=$temindex?>]" value="<?=$rowattach[id]?>"/>
			</div>
		<?php $temindex+=1;}
		?>
	</div>
</div>
	<?php
}
mysql_close($connection);

?>
